import request from '@/utils/request'

export function login(username, password) {
  return request({
    url: '/god/login',
    method: 'post',
    data: {
      username,
      password
    }
  })
}

export function getInfo(token) {
  return request({
    url: '/god/info',
    method: 'get',
    params: {token}
  })
}

export function logout() {
  return request({
    url: '/god/logout',
    method: 'post'
  })
}

//注册接口
export function registerUser(data) {
  return request({
    url: '/auth/register',
    method: 'post',
    data: data
  })
}

//验证图片验证码
export function verifyImageCode(phone, imageCode) {
  return request({
    url: '/auth/verify/img_code',
    method: 'post',
    params: {
      image_code: imageCode,
      mobile: phone
    }
  })
}

//发送短信验证码
export function sendTextMessage(mobile, imageCode) {
  return request({
    url: '/auth/send_txt_msg',
    method: 'post',
    params: {
      mobile: mobile,
      auth_code: imageCode
    }
  })
}

//验证短信验证码
export function verifyTxtMsgCode(mobile, msgCode) {
  return request({
    url: '/auth/check_msg_code',
    method: 'post',
    params: {
      mobile: mobile,
      msg_auth_code: msgCode
    }
  })
}

//通过短信重置密码
export function resetPasswordByTxtMsg(mobile, newPassword, authCode) {
  return request({
    url: '/auth/reset_password',
    method: 'post',
    data: {
      mobile: mobile,
      newPassword: newPassword,
      authCode: authCode
    }
  })
}
